/*    */ package com.zimbra.cs.service.admin;
/*    */ 
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.common.soap.AdminConstants;
/*    */ import com.zimbra.common.soap.Element;
/*    */ import com.zimbra.common.util.Log;
/*    */ import com.zimbra.common.util.ZimbraLog;
/*    */ import com.zimbra.cs.account.CalendarResource;
/*    */ import com.zimbra.cs.account.Provisioning;
/*    */ import com.zimbra.cs.account.accesscontrol.AdminRight;
/*    */ import com.zimbra.cs.account.accesscontrol.Rights.Admin;
/*    */ import com.zimbra.cs.account.accesscontrol.TargetType;
/*    */ import com.zimbra.soap.JaxbUtil;
/*    */ import com.zimbra.soap.ZimbraSoapContext;
/*    */ import com.zimbra.soap.admin.message.CreateCalendarResourceRequest;
/*    */ import java.util.List;
/*    */ import java.util.Map;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class CreateCalendarResource
/*    */   extends AdminDocumentHandler
/*    */ {
/*    */   public boolean domainAuthSufficient(Map context)
/*    */   {
/* 47 */     return true;
/*    */   }
/*    */   
/*    */ 
/*    */ 
/*    */ 
/*    */   public boolean defendsAgainstDelegateAdminAccountHarvesting()
/*    */   {
/* 55 */     return true;
/*    */   }
/*    */   
/*    */   public Element handle(Element request, Map<String, Object> context)
/*    */     throws ServiceException
/*    */   {
/* 61 */     ZimbraSoapContext zsc = getZimbraSoapContext(context);
/* 62 */     Provisioning prov = Provisioning.getInstance();
/* 63 */     CreateCalendarResourceRequest req = (CreateCalendarResourceRequest)JaxbUtil.elementToJaxb(request);
/*    */     
/* 65 */     String name = req.getName().toLowerCase();
/* 66 */     checkDomainRightByEmail(zsc, name, Rights.Admin.R_createCalendarResource);
/*    */     
/* 68 */     Map<String, Object> attrs = req.getAttrsAsOldMultimap(true);
/* 69 */     checkSetAttrsOnCreate(zsc, TargetType.calresource, name, attrs);
/*    */     
/* 71 */     String password = req.getPassword();
/* 72 */     CalendarResource resource = prov.createCalendarResource(name, password, attrs);
/*    */     
/* 74 */     ZimbraLog.security.info(ZimbraLog.encodeAttrs(new String[] { "cmd", "CreateCalendarResource", "name", name }, attrs));
/*    */     
/*    */ 
/* 77 */     Element response = zsc.createElement(AdminConstants.CREATE_CALENDAR_RESOURCE_RESPONSE);
/* 78 */     ToXML.encodeCalendarResource(response, resource, true);
/* 79 */     return response;
/*    */   }
/*    */   
/*    */   public void docRights(List<AdminRight> relatedRights, List<String> notes)
/*    */   {
/* 84 */     relatedRights.add(Rights.Admin.R_createCalendarResource);
/* 85 */     notes.add(String.format("All attrs provided in the attribute list have to settable by. the authed admin.   You can grant the %s right, which allows setting all attributes on %s, or grant the set attrs right just for the attributes the admin needs to set while creating an entry.", new Object[] { Rights.Admin.R_modifyCalendarResource.getName(), "calendar resource" }));
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/service/admin/CreateCalendarResource.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */